<template>
  <div class="main">
    <div class="menu">
      <swiper :options="swiperOption" style="height:100%">
        <swiper-slide v-for="(item,index) in shopBanner" :key="index" :style="{backgroundImage:'url(' + item.imgUrl + ')'}">
        </swiper-slide>
        <div class="swiper-pagination swiper-pagination-white" slot="pagination"></div>
        <!-- <div class="swiper-button-prev swiper-button-white" slot="button-prev"></div>
        <div class="swiper-button-next swiper-button-white" slot="button-next"></div> -->
      </swiper>
      <div class="top_menu">
          <my-menu></my-menu>
      </div>
    </div>
    <div class="clearfix adv">
      <router-link to="/list?type=1" class="back-img first">
        <div class="floor-content">
          <div class="represent">
            <div class="div-box">
              <p class="describe">团购</p>
              <p class="depict">底价成团 限时限量</p>
            </div>
          </div>
        </div>
        <img src="//img003.mllres.com/images/201807/1532540414266071876.jpg" style="opacity: 1;">
      </router-link>
      <router-link to="/list?type=2" class="back-img">
        <div class="floor-content">
          <div class="represent">
            <div class="div-box">
              <p class="describe">现货特卖</p>
              <p class="depict">低至2折 就是要便宜</p>
            </div>
          </div>
        </div>
        <img src="//image.meilele.com/images/201807/1532541445612807005.jpg" style="opacity: 1;">
      </router-link>
      <router-link to="/list?type=3" class="back-img">
        <div class="floor-content">
          <div class="represent">
            <div class="div-box">
              <p class="describe">小户优选</p>
              <p class="depict">60平的房子 90平的家</p>
            </div>
          </div>
        </div>
        <img src="//img003.mllres.com/images/201808/1534700283144655327.jpg" style="opacity: 1;">
      </router-link>
      <router-link to="/list?type=4" class="back-img">
        <div class="floor-content">
          <div class="represent">
            <div class="div-box">
              <p class="describe"></p>
              <p class="depict"></p>
            </div>
          </div>
        </div>
        <img src="//img003.mllres.com/images/201810/1540517927955133730.jpg" style="opacity: 1;">
      </router-link>
    </div>
    <div class="shop_list">
      <div class="new-product _view_ jsFloor">
        <div class="floor-name clearfix">
          <a class="title" href="/info">新品首发</a>
          <span class="describe"></span>
        
          <router-link to="/list" class="link"> 更多新品
            <i></i></router-link>
        </div>
        <div class="goods-list clearfix">
          <router-link
            :to="'/info?id='+item.id"
            :class="[index=='0'?'first':'','back-img']"
            v-for="(item,index) in newList"
            :key="index"
          >
            <div class="floor-content">
              <span class="describe">{{item.shop_title}}</span>
              <br>
              <span class="depict">新品到.立即前往&gt;&gt;</span>
            </div>
            <img
              :src="'http://www.baseco.top/ljm/public/uploads/shop/'+item.shop_img"
              style="opacity: 1;"
            >
          </router-link>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { ljmAjax,POST } from "@/api/index";
import menu from "@/components/menu.vue"
export default {
  data() {
    return {
      newList: {},
      shopBanner:[
          {
              imgUrl:'//image.meilele.com/images/201902/1551294771398057990.jpg',
              // imgUrl:'http://www.baseco.top/ljm_Img/surmon-1.jpg',
              title:'手势',
              id:1
          },
          {
              imgUrl:'//img001.mllres.com/images/201902/1551137188051040347.jpg',
              // imgUrl:'http://www.baseco.top/ljm_Img/surmon-6.jpg',
              title:'手势',
              id:2
          },
          {
              imgUrl:'//img003.mllres.com/images/201808/1533778323996774457.jpg',
              // imgUrl:'http://www.baseco.top/ljm_Img/surmon-8.jpg',
              title:'手势',
              id:3
          }
      ],
       swiperOption: {
          spaceBetween: 30,
          effect: 'fade',
          loop: true,
          autoplay: {
            delay: 2500,
            disableOnInteraction: false
          },
          pagination: {
            el: '.swiper-pagination',
            clickable: true
          }
        }
    };
  },
  components: {
    'my-menu':menu
      },
  created() {
    this.getIndex();
   
  },
  methods:{
    getIndex(){
       ljmAjax("api/index/getIndex").then(res => {
      console.log(res.data.data);
      this.newList = res.data.data;
    });
    },
    goToView(id){
      console.log(id)
    }

  }
};
</script>
<style lang="scss">
.swiper-slide {
  background-position: center;
  background-size: cover;
}
.swiper-pagination-bullet{
  background: #fff;
  opacity: 1;
}
.swiper-pagination-white .swiper-pagination-bullet-active{
  background: #000;
}
.swiper-container-horizontal > .swiper-pagination-bullets .swiper-pagination-bullet{
  border-radius: 0px !important;
  width: 25px;
  height: 5px;
}
</style>

<style lang="scss" scoped >
.menu{
  height:460px;
  position: relative;
  .top_menu{
    position: absolute;
    top:0px;
    left:calc(50% - 600px);
    height: 460px;
    z-index: 99;
  }
}
.main {
  min-height: 800px;
}

.adv {
  width: 1200px;
  margin: 30px auto;
}
.adv .back-img.first {
  width: 393px;
  margin-left: 0;
}
.adv .back-img {
  width: 259px;
  height: 300px;
  margin-left: 10px;
  float: left;
  display: block;
  position: relative;
  overflow: hidden;
}
.adv .back-img img {
  -webkit-transition: -webkit-transform 1s;
  transition: -webkit-transform 1s;
  transition: transform 1s;
  transition: transform 1s, -webkit-transform 1s;
}
.back-img:hover img {
  width: 103%;
  height: 103%;
  top: -1.5%;
  left: -1.5%;
  transform: scale(1.05);
}
.adv .first .div-box {
  background: #fff;
}
.adv .first .depict {
  padding-bottom: 18px;
}
.adv .floor-content .describe {
  font-size: 22px;
  color: #333;
  margin-bottom: 2px;
  padding: 18px 0 4px 0;
  font-family: "微软雅黑";
}
.adv .floor-content .depict {
  font-size: 14px;
  color: #666;
  font-family: "微软雅黑";
}
.adv .floor-content {
  top: 40px;
  text-align: center;
  position: absolute;
  z-index: 10;
  width: 100%;
}
.back-img img {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  -webkit-transition: -webkit-transform 1s;
  transition: -webkit-transform 1s;
  transition: transform 1s;
  transition: transform 1s, -webkit-transform 1s;
}
.shop_list {
  width: 1200px;
  margin: 0 auto;
}
.shop_list .floor-name {
  padding: 45px 0 17px 0;
  background: #fff;
}
.shop_list .floor-name .title {
  color: #333;
  font-size: 24px;
  float: left;
  line-height: 32px;
  font-weight: 700;
  font-family: "微软雅黑";
}
.shop_list .floor-name .link {
  font-size: 14px;
  line-height: 20px;
  color: #666;
  width: 78px;
  float: right;
  margin-top: 14px;
  font-family: "微软雅黑";
}
.shop_list .goods-list .back-img {
  width: 393px;
  height: 300px;
  margin-left: 10px;
  float: left;
  display: block;
  position: relative;
  overflow: hidden;
}
.shop_list .goods-list .first {
  margin-left: 0;
}
.shop_list .goods-list .floor-content .describe {
  font-family: "微软雅黑";
  display: inline-block;
  color: #fff;
  font-size: 24px;
  line-height: 32px;
  border-bottom: 2px solid #fff;
  padding-bottom: 8px;
  margin-bottom: 8px;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shop_list .goods-list .floor-content .depict {
  font-family: "微软雅黑";
  color: #fff;
  font-size: 14px;
  display: inline-block;
}
.shop_list .goods-list .floor-content .depict label {
  margin: 0 2px 0 7px;
  color: red;
}
.shop_list .goods-list .floor-content .depict .JS_async_price {
  color: red;
}
.shop_list .goods-list .floor-content {
  bottom: 38px;
  text-align: center;
  position: absolute;
  z-index: 10;
  width: 100%;
}
</style>


